import Vue from 'vue'
import Router from 'vue-router'
import Main from "../components/Main";
import Home from "../components/view/Home";
import Login from "../components/Login";
import ChoseCourse from "../components/view/student/ChoseCourse";
import Course from "../components/view/student/Course";
import CourseTable from "../components/view/student/CourseTable";
import StudentScore from "../components/view/student/StudentScore";
import StudentInfo from "../components/view/student/StudentInfo";
import TeacherCourse from "../components/view/teacher/TeacherCourse";
import TeacherCourseTable from "../components/view/teacher/TeacherCourseTable";
import TeacherSetStudentScore from "../components/view/teacher/TeacherSetStudentScore";

Vue.use(Router)
// 处理 导航重复点击请求问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default new Router({
  routes: [
    {
      path: '/',
      name: 'Login',
      component: Login
    },
    {
      path: '/Main',
      name: 'Main',
      component: Main,
      children: [
        {
          path: '/',
          name: 'Home',
          component: Home
        },
        {
          path: '/ChoseCourse',
          name: 'ChoseCourse',
          component: ChoseCourse
        },
        {
          path: '/Course',
          name: 'Course',
          component: Course
        },
        {
          path: '/CourseTable',
          name: 'CourseTable',
          component: CourseTable
        },
        {
          path: '/StudentScore',
          name: 'StudentScore',
          component: StudentScore
        },
        {
          path: '/StudentInfo',
          name: 'StudentInfo',
          component: StudentInfo
        },
        {
          path: '/TeacherCourse',
          name: 'TeacherCourse',
          component: TeacherCourse
        },
        {
          path: '/TeacherCourseTable',
          name: 'TeacherCourseTable',
          component: TeacherCourseTable
        },
        {
          path: '/TeacherSetStudentScore',
          name: 'TeacherSetStudentScore',
          component: TeacherSetStudentScore
        }
      ]
    }
  ]
})
